<?php

App::uses('AppController', 'Controller');

/**
 * AdminProjects Controller
 *
 */
class AdminProjectsController extends AppController {

    /**
     * Scaffold
     *
     * @var mixed
     */
    public $scaffold;
    public $uses = array('Project','Property');
    
    public function beforeFilter() {
        parent::beforeFilter();
        $this->layout = "default_admin";
    }

    public function index($propertyId = NULL, $projectTypeId = NULL) {
        if ($propertyId != NULL) {
            $dataProperty = $this->Property->getDetail($propertyId);
            $dataProjectArr = $this->Project->listAllAdmin($propertyId,$projectTypeId);
            
            $this->set('dataProjectArr', $dataProjectArr);            
            $this->set('dataProperty',$dataProperty);
            $this->set('projectTypeId',$projectTypeId);
        } else {
            $this->redirect(DEFAULT_ADMIN_REDIREC);
        }
    }

}
